defmetricpaperA840.9mm1189.2mm defmetricpaperB1000mm1414mm defmetricpaperC917mm1297mm defmetricpaper=
@shiftmargins shiftmarginsfalse ifundefinedmargin@offset
ifnextchar[@setps@setps[portrait]A4 @shiftmargins 0in0in -1in-1in -ifundefinedfootheight0= 35mm 0 by25mm 0 - 1= 20mm 1 by15mm 1 1 1 1 - 0>@ 1>@
Page Size and Margins =====================
These macros make it easy to set page margins for a chosen paper size. Actual dimensions of the most common paper sizes are stored and need not be remembered.
Two sided printing is supported, meaning that if on odd pages the left margin is, say, 30mm and the right margin is 20mm, it will be vice versa on even pages. This gives equal margins on the outer and the inner edge of the paper, as expected e.g. for a book.
The size of the paper can be set with
ifnextchar[@setps@setps[portrait]<size>
<size> can be A0, A1, ..., A9, B0, B1, ..., B9, C0, ..., C9, USletter, USlegal, and USexecutive. The metric paper sizes are not stored but calculated.
Landscape format is selected by using the optional argument
ifnextchar[@setps@setps[portrait][landscape]<size>
which swaps the width and height dimensions of the paper. ifnextchar[@setps@setps[portrait][portrait]<size> is allowed but is the default.
If you have a size which is not pre-defined use
ifnextchar[@setps@setps[portrait]custom<width><height>
For <width> and <height> insert the respective dimensions of your paper.
ifnextchar[@setps@setps[portrait]stores the actual dimensions of the paper in the length variables
which can be used further, if desired.
yields true if a landscape format is selected. Do not write , , or call or , it will not work!!
The margins can be set with
@shiftmargins 0in0in -1in-1in leftmargin -leftmargin -textwidth topmargin textwidth textheight headheight headsep ifundefinedfootheightfootheightfootskip 0= leftmargin 0 bytextwidth 0 - 1= topmargin 1 bytextheight 1 1 1 1 - 0>@ 1>@
or with
@shiftmargins 0in0in -1in-1in -leftmargin -rightmargin -topmargin -headheight -headsep -footskip -bottommargin leftmargin -leftmargin -topmargin headheight headsep ifundefinedfootheightfootheightfootskip 0= leftmargin 0 byrightmargin 0 - 1= topmargin 1 bybottommargin 1 1 1 1 - 0>@ 1>@
In the latter case and are calculated using the width and height of the selected paper. The first four parameters of the above two commands are used to set , , , , and
@shiftmargins 0in0in -1in-1in , -, -
@shiftmargins 0in0in -1in-1in —
-P –
ifundefinedfootheight0= 0 by0 - 1=
1 byP 1 1 1 1 - 0>@ 1>@ ifundefinedfootheight0= , 0 by
0 - 1= @shiftmargins 0in0in -1in-1in —b – ifundefinedfootheight0= 0 by1 0 - 1= 1 byb 1 1 1 1 - 0>@ 1>@ yP 1 1 1 1 - 0>@ 1>@ rovide a page with no header and footer. They work the same as @shiftmargins 0in0in -1in-1in , -, -e @shiftmargins 0in0in -1in-1in —e –c -e -x –e c ifundefinedfootheighte 0= 0 by0 - 1= e 1 byx 1 1 1 1 - 0>@ 1>@ ifundefinedfootheightpt 0= , 0 bye 0 - 1= @shiftmargins 0in0in -1in-1in —y -x - -b – y x ifundefinedfootheight 0= 0 by1 0 - 1= 1 byb 1 1 1 1 - 0>@ 1>@ 1 1 1 1 - 0>@ 1>@ that they only need the first 4 parameter. The last 4 parameter are set to 0pt. These 2 commands set the pagestyle to empty () as there is no space for headers or footers.
@shiftmargins 0in0in -1in-1in , -, -
@shiftmargins 0in0in -1in-1in —
—-a –
ifundefinedfootheight0= 0 by0 - 1=
1 bya 1 1 1 1 - 0>@ 1>@ ifundefinedfootheight0= , 0 by
0 - 1= @shiftmargins 0in0in -1in-1in ——b – ifundefinedfootheight0= 0 by1 0 - 1= 1 byb 1 1 1 1 - 0>@ 1>@ ya 1 1 1 1 - 0>@ 1>@ re the same as @shiftmargins 0in0in -1in-1in , -, -a @shiftmargins 0in0in -1in-1in —a -p –a ifundefinedfootheight0= 0 by0 - 1= a 1 byp 1 1 1 1 - 0>@ 1>@ ifundefinedfootheight0= , 0 bya 0 - 1= @shiftmargins 0in0in -1in-1in —b – ifundefinedfootheight0= 0 by1 0 - 1= 1 byb 1 1 1 1 - 0>@ 1>@ yp 1 1 1 1 - 0>@ 1>@ art from that the last 4 parameter to @shiftmargins 0in0in -1in-1in , -, -a @shiftmargins 0in0in -1in-1in —a –e -u -r –a e ifundefinedfootheightu 0= 0 by0 - 1= a 1 byr 1 1 1 1 - 0>@ 1>@ ifundefinedfootheightnc 0= , 0 bya 0 - 1= @shiftmargins 0in0in -1in-1in —y -r - -b – y r ifundefinedfootheight 0= 0 by1 0 - 1= 1 byb 1 1 1 1 - 0>@ 1>@ 1 1 1 1 - 0>@ 1>@ hanged.
Example:
A4 paper, left margin 30mm, top, right, and bottom margin 20mm each, no headers or footers:
ifnextchar[@setps@setps[portrait]A4 @shiftmargins 0in0in -1in-1in -ifundefinedfootheight0= 30mm 0 by20mm 0 - 1= 20mm 1 by20mm 1 1 1 1 - 0>@ 1>@
The same settings would result by:
ifnextchar[@setps@setps[portrait]A4 @shiftmargins 0in0in -1in-1in -ifundefinedfootheight0= 30mm 0 by20mm 0 - 1= 20mm 1 by20mm 1 1 1 1 - 0>@ 1>@
For the default settings please see the part after "DEFAULTS:" (last
The default top and left margins of TeX are +1in. call
@shiftmargins 0in0in -1in-1in
which initialises , to -1in and , , to 0in. then add the given dimensions to , , In some cases it might be desired to use instead of for compensation. This can be achieved by telling @shiftmargins 0in0in -1in-1in to initialise to 0in and to -1in. This is done by shiftmarginstrue. If @shiftmargins 0in0in -1in-1in is already defined at the time Vmargin is loaded it is NOT redefined! Therefore if @shiftmargins 0in0in -1in-1in is defined before Vmargin is loaded the above mentioned compensation can be replaced by a different mechanism. In any way call @shiftmargins 0in0in -1in-1in and then expect that are set to useful values. are not touched by . @shiftmargins 0in0in -1in-1in should be defined in a separate file which is included BEFORE Vmargin, i.e. appears in the list of document-substyles of the command before Vmargin.Any better way of doing this? (grumble)Example: if @shiftmargins 0in0in -1in-1in is defined in a file called margins.sty.
LaTeX2e:
LaTeX2e ——-
This style (or package) works with LaTeX2e. To keep it working under LaTeX2.09 none of the special LaTeX2e package interface features have been used. There will probably be a new version (under a new name) that is specialised for LaTeX2e.
LaTeX2e (unless in compatibility mode) does not know any more. This dimension is not set if it is not defined, but is set otherwise (i.e. it is set in LaTeX2e compatibility mode).
LaTeX2e now has the dimensions , which hold the size of the paper. , are copied into , if the latter exist. This makes Vmargin work correctly with anything that expects , to be set properly. The names , had been chosen in the first place to avoid clashes with style files that also use these names (namely pageframe.sty).
Inclusion in TeX formats ————————
This file may be loaded in initex before dumping the format, by typing =Vmargin.sty Note: this produces a non-standard format.
Hints for using pageframe.sty —————————–
Vmargin.sty and pageframe.sty can be used together if the following points are considered:
Vmargin uses and and writes negative values into it, pageframe expects them to be zero to give a 1in space on the left and the top where it prints additional information. Initially, set both to 0mm (in the pre-amble of your text) and adjust them later on.
pageframe needs to know the trimmed height of the paper (= the height of the "page frame"). Unless the trimmed(!) size of the paper is equivalent to one of the standard paper sizes (unlikely...) the size should be specified with
ifnextchar[@setps@setps[portrait]custom<width><height>
The correct height of the trimmed page can then be given to pageframe using
and the margins of the final product (inside the page frame) can be specified using .
Warning: if is used the 3rd parameter (right margin) is ignored. Instead, the dimension of the right margin has to be assigned to This is because pageframe.sty re-defines the meaning of to be the right margin of your text, on all pages.
Remember: all these assignments and macro calls have to be in the pre-amble of the document.
To do: ——
* The way how the metric paper sizes are stored takes up a lot of space. A metric size could be computed by ifnextchar[@setps@setps[portrait].
* Make use of new LaTeX2e features. If I do I will probably give the package a new name.
SUMMARY: ========
new lengths:
new ifs:
new macros: ifnextchar[@setps@setps[portrait][<orientation>]<size>, ifnextchar[@setps@setps[portrait][<orientation>]custom<width><height> <orientation> (optional) = landscape or portrait (default) <size> = A4, B5, ... <width>, <height> = actual dimensions of the paper @shiftmargins 0in0in -1in-1in leftmargin -leftmargin -textwidth topmargin textwidth textheight headheight headsep ifundefinedfootheightfootheightfootskip 0= leftmargin 0 bytextwidth 0 - 1= topmargin 1 bytextheight 1 1 1 1 - 0>@ 1>@ @shiftmargins 0in0in -1in-1in -leftmargin -rightmargin -topmargin -headheight -headsep -footskip -bottommargin leftmargin -leftmargin -topmargin headheight headsep ifundefinedfootheightfootheightfootskip 0= leftmargin 0 byrightmargin 0 - 1= topmargin 1 bybottommargin 1 1 1 1 - 0>@ 1>@ @shiftmargins 0in0in -1in-1in leftmargin -leftmargin -textwidth topmargin textwidth textheight ifundefinedfootheight0= leftmargin 0 bytextwidth 0 - 1= topmargin 1 bytextheight 1 1 1 1 - 0>@ 1>@ @shiftmargins 0in0in -1in-1in -leftmargin -rightmargin -topmargin -bottommargin leftmargin -leftmargin -topmargin ifundefinedfootheight0= leftmargin 0 byrightmargin 0 - 1= topmargin 1 bybottommargin 1 1 1 1 - 0>@ 1>@ @shiftmargins 0in0in -1in-1in leftmargin -leftmargin -textwidth topmargin textwidth textheight ifundefinedfootheight0= leftmargin 0 bytextwidth 0 - 1= topmargin 1 bytextheight 1 1 1 1 - 0>@ 1>@ @shiftmargins 0in0in -1in-1in -leftmargin -rightmargin -topmargin —-bottommargin leftmargin -leftmargin -topmargin ifundefinedfootheight0= leftmargin 0 byrightmargin 0 - 1= topmargin 1 bybottommargin 1 1 1 1 - 0>@ 1>@ @shiftmargins 0in0in -1in-1in shiftmarginstrue
If you have any comments (positive or negative) please let me know!
HISTORY: ========
. . Created out of Vpage.sty. . V1.7 21 May 1994 Changed file header. V1.72 21 May 1994 Fixed bug in ifnextchar[@setps@setps[portrait]custom V1.8 28 May 94 Commented 0= ; 0 bye 0 - 1= r 1 byd 1 1 1 1 - 0>@ 1>@ uced load on TeX's parameter stack (changed 0= ) 0 byP 0 - 1= . 1 byu 1 1 1 1 - 0>@ 1>@ t a conditional around references to V1.9 22 Jun 94 Corrected spelling in comment. V2.0 28 Jun 94 Added support for LaTeX2e , . V2.1 20 Sep 94 defmetricpaper now defines , , locally. Thanks to branderhorst@fgg.eur.nl!;''